package com.example.zlw.dem5;

/**
 * @program: Zlw
 * @description:
 * @author: 诸葛龙辰
 * @create: 2022-11-04 21:08
 **/

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.stream.IntStream;
import java.util.stream.Stream;

/**
 * 获取Stream的方式
 */
public class Test {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        //1.通过集合来获取Stream对象
        Collections.addAll(list,"野猪佩奇","野猪乔治","黑猪佩奇","野猪王佩奇");
        Stream<String> stream = list.stream();
        //2.通过Arrays中的静态方法来获取Stream
        String [] zhu = {"野猪家族","黑猪家族"};
        Stream<String>  stream1 = Arrays.stream(zhu);
        //3.通过Stream中的静态方法of来获取Stream
        Stream<String> ts1 = Stream.of("野猪家族","黑猪家族");
    }
}




